import request from "@/api/index";

// 获取验证码
export function getSMSCode(params) {
  return request({
    url: "/api/getSMSCode",
    method: "get",
    params: params
  });
}
// 登录
export function login(data) {
  return request({
    url: "/user/nolog/userLogin/login",
    method: "post",
    data: data,
    headers: {
      CHANNEL: "partPlay",
      SIMULATOR: "false",
      SOURCE: "from-web",
      AREA: data.perfix,
      PLATFORM: "web"
    }
  });
}
// 退出账户登录
export function logout(data) {
  return request({
    url: "/user/nolog/userLogin/logout",
    method: "post",
    data: data
  });
}
// 自动登录（根据本地已有的token）
export function autoLogin(data) {
  return request({
    url: "/user/nolog/userLogin/autoLogin",
    method: "post",
    data: data
  });
}

// 获取多语言
export function getLanguageCode(params) {
  return request({
    url: "/user/nolog/sms/getLanguageCode",
    method: "get",
    params: params
  });
}
// 获取不同国家地区的手机号前缀
export function getCountryCode(params) {
  return request({
    url: "/user/nolog/sms/getCountryCode",
    method: "get",
    params: params
  });
}
// 请求发送手机短信验证码
export function sendCode(params) {
  return request({
    url: "/user/nolog/sms/sendCode",
    method: "get",
    params: params
  });
}
// 检测手机短信验证码是否正确
export function checkSmsCode(params) {
  return request({
    url: "/user/nolog/sms/checkSmsCode",
    method: "get",
    params: params
  });
}

// 获得邮箱验证码
export function sendEmailCode(params) {
  return request({
    url: "/user/nolog/sms/sendEmailCode",
    method: "get",
    params: params
  });
}
// 检测邮箱验证码是否正确
export function checkEmailCode(params) {
  return request({
    url: "/user/nolog/sms/checkEmailCode",
    method: "get",
    params: params
  });
}
// 检测邮箱是否已注册过
export function checkExistEmail(params) {
  return request({
    url: "/user/nolog/sms/checkExistEmail",
    method: "get",
    params: params
  });
}

// 获取用户信息
export function userinfoGet(data) {
  return request({
    url: "/user/userinfo/get",
    method: "post",
    data: data
  });
}
